package org.android.brasil.projetos.oktoberfest2011.view.controller;

import org.android.brasil.projetos.oktoberfest2011.R;
import org.android.brasil.projetos.oktoberfest2011.utils.AnalyticsUtils;
import org.android.brasil.projetos.oktoberfest2011.utils.ControleDeBackground;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;

public class EasterEgg extends ListActivity {

	private AnalyticsUtils mGa;
	
	private OnClickListener casaListener = new OnClickListener() {

		public void onClick(View v) {
			Intent i = new Intent(getApplicationContext(),HomeController.class);
			i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(i);
			mGa.buttonTrackEvent("Casa");
		}
	};
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.easter_egg_view);
		this.mGa = AnalyticsUtils.getInstance(this);
		
		ListView lv = getListView();
		String[] frases = getResources().getStringArray(R.array.frases);
		lv.setAdapter(new ArrayAdapter<String>(getApplicationContext(), R.layout.easter_egg_item,frases));
		
		ImageView casa = (ImageView) findViewById(R.id.casa);
		casa.setOnClickListener(casaListener);
		
		RelativeLayout rl = (RelativeLayout) findViewById(R.idEasterEgg.relativeLayout01);

		ControleDeBackground.SetBarraSuperiorBackGround(
				getApplicationContext(), rl);

	}
}
